1    <?php
2 session_start();
// Use session variable on this page. This function must put on the top of page.
3 if
(!isset($_SESSION['username']) || $_SESSION['usertype'] !='admin'){ // if session variable "username" does not exist.
4 header(
"location:index.php?msg=Please%20login%20to%20access%20admin%20area%20!"); // Re-direct to index.php
5 }

6 else

7 {
8     include_once
"db.php";
9     error_reporting (E_ALL ^ E_NOTICE);
10
11 ?><!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
12 "http:
//www.w3.org/TR/html4/loose.dtd">
13 <html>
14 <head>
15 <title>Welcome to Stock Management System !</title>
16 <meta http-equiv=
"Content-Type" content="text/html; charset=iso-8859-1">
17 <META Http-Equiv=
"Cache-Control" Content="no-cache">
18 <META Http-Equiv=
"Pragma" Content="no-cache">
19 <META Http-Equiv=
"Expires" Content="0">
20 <link rel=
"stylesheet" href="css/validationEngine.jquery.css" type="text/css" media="screen" title="no title" charset="utf-8" />
21         <link rel=
"stylesheet" href="css/template.css" type="text/css" media="screen" title="no title" charset="utf-8" />
22         <script src=
"js/jquery.min.js" type="text/javascript"></script>
23         <script type=
"text/javascript" src="jquery.date_input.js"></script>
24 <link rel=
"stylesheet" href="date_input.css" type="text/css">
25 <script type=
"text/javascript">$(function() {
26   $(
"#datefield").date_input();
27    $(
"#due").date_input();
28 });</script>
29
30 <script type=
'text/javascript' src='lib/jquery.bgiframe.min.js'></script>
31 <script type=
'text/javascript' src='lib/jquery.ajaxQueue.js'></script>
32 <script type=
'text/javascript' src='lib/thickbox-compressed.js'></script>
33 <script type=
'text/javascript' src='jquery.autocomplete.js'></script>
34
35 <script type=
'text/javascript' src='localdata.js'></script>
36
37 <link rel=
"stylesheet" type="text/css" href="jquery.autocomplete.css" />
38 <link rel=
"stylesheet" type="text/css" href="lib/thickbox.css" />
39     
40 <script type=
"text/javascript">
41 $().ready(function() {
42
43     function log(
event, data, formatted) {
44         $(
"<li>").html( !data ? "No match!" : "Selected: " + formatted).appendTo("#result");
45     }
46     
47     function formatItem(row) {
48         
return row[0] + " (<strong>id: " + row[1] + "</strong>)";
49     }
50     function formatResult(row) {
51         
return row[0].replace(/(<.+?>)/gi, '');
52     }
53     
54     
55
56
57     
58     
59     $(
"#supplier").autocomplete("supplier1.php", {
60         width:
160,
61         autoFill:
true,
62         selectFirst:
false
63     });
64     
65
66     
67 });
68
69
70 </script>
71
72         <script type=
"text/javascript" src="lib/jquery-ui-1.7.2.custom.min.js"></script>
73         <script type=
"text/javascript" src="jquery-dynamic-form.js"></script>
74         <script type=
"text/javascript">
75             $(document).ready(function(){
76                 $(
"#duplicate").dynamicForm("#plus", "#minus", {limit:50, createColor: 'yellow',removeColor: 'red'});
77                 
78             });
79         </script>
80         <script src=
"js/jquery.validationEngine-en.js" type="text/javascript"></script>
81         <script src=
"js/jquery.validationEngine.js" type="text/javascript"></script>
82          <script src=
"js/jquery.hotkeys-0.7.9.js"></script>
83         <!-- AJAX SUCCESS TEST FONCTION
84             <script>function callSuccessFunction(){alert(
"success executed")}
85                     function callFailFunction(){alert(
"fail executed")}
86             </script>
87         -->
88         
89         <script>
90         
91         function callAutoComplete(idname)
92     {
93     
94     $(
"#"+idname).autocomplete("stock.php", {
95         width:
160,
96         autoFill:
true,
97         mustMatch:
true,
98         selectFirst:
false
99     });
100     
101     
102     
103     }
104     
105     
106     function checkDublicateName()
107     {
var k=0;
108                 
for (i=0;i<=400;i=i+6)
109                     {
110                     
if($("#0"+i).length>0)
111                     { $k=
0;
112                              
for (j=0;j<=400;j=j+6)
113                             {
114                             
if($("#0"+j).length>0 && $("#0"+i).val()==$("#0"+j).val())
115                             {
116                              $k++;
117                              
118                             }
119                             }
120                         
if($k>1)
121                     {
122                     alert(
"Dublicate stock Entry. please remove new and add stock in existing one !");
123                     
124                     }
125                      
126                     }
127                     }
128                     
129                     
130                     
131                     
132                     
133     }
134
135     function callAutoAsignValue(idname)
136     {
137             
138              
var name1 = parseInt(idname,10);
139              
var quantity1 = name1+1;
140              
var brate1 = quantity1+1;
141              
var srate1 = brate1+1;
142              
var avail1 = srate1+1;
143              
var total1 = avail1+1;
144             
145              
if(parseInt(idname)>0)
146              {
147              quantity1=
"00"+quantity1;
148              brate1=
"000"+brate1;
149              srate1=
"0000"+srate1;
150              avail1=
"00000"+avail1;
151              total1=
"000000"+total1;
152              
153              }
154              
else
155              {
156               quantity1=
"00";
157               brate1=
"000";
158               srate1=
"0000";
159               avail1=
"00000";
160               total1=
"000000";
161               
162              }
163              
164                 
165         $.post(
'check_stock_details.php', {stock_name: $("#"+idname).val() },
166                 function(data){
167                 
168                                 
// if(data=='no') //if username not avaiable
169                                 
// {
170                                 
// $("#category").focus();
171                                 
// }
172                                                             
173                                 $(
"#"+brate1).val(data.buyingrate);
174                                 $(
"#"+srate1).val(data.sellingprice);
175                                 $(
"#"+avail1).val(data.available);
176                                 $(
"#quantity").focus();
177                             },
'json');
178                             
179                             
180                         checkDublicateName();
181                             
182     }
183     
184     
185     function callQKeyUp(Qidname)
186     {
187     
188             
189              
190              
var quantity = parseInt(Qidname,10);
191              
var brate = quantity+1;
192              
var srate = brate+1;
193              
var avail = srate+1;
194              
var total = avail+1;
195              
var rowcount = parseInt((total+1)/5);
196              
if(rowcount==0)
197              rowcount=
1;
198             
199              
if(parseInt(Qidname)>0)
200              {
201              quantity=
"00"+quantity;
202              brate=
"000"+brate;
203              srate=
"0000"+srate;
204              avail=
"00000"+avail;
205              total=
"000000"+total
206              }
207              
else
208              {
209               quantity=
"00";
210               brate=
"000";
211               srate=
"0000";
212               avail=
"00000";
213               total=
"000000";
214               
215               
216              }
217             
var result= parseFloat($("#"+quantity).val()) * parseFloat( $("#"+brate).val() );
218             result=result.toFixed(
2);
219             $(
"#"+total).val(result);
220             updateSubtotal();
221             
222     }
223     function balanceCalc()
224     {
if(parseFloat($("#payment").val()) > parseFloat($("#subtotal").val()))
225             $(
"#payment").val(parseFloat($("#subtotal").val()));
226             
227             
var result= parseFloat($("#subtotal").val()) - parseFloat( $("#payment").val() );
228             result=result.toFixed(
2);
229             $(
"#balance").val(result);
230     }
231     function updateSubtotal()
232     {
233                     
var temp=0;
234                     
for (i=5;i<=400;i=i+6)
235                     {
236                     
if($("#000000"+i).length>0)
237                     {
238                      temp=parseFloat(temp)+parseFloat($(
"#000000"+i).val());
239                      
240                     }
241                     }
242                 
243             
244             
var subtotal=parseFloat(temp);
245             
246             
if($("#000000").length>0)
247             {
248             
var firstrowvalue=$("#000000").val();
249             
250             subtotal=parseFloat(subtotal)+parseFloat(firstrowvalue);
251             }
252             subtotal=subtotal.toFixed(
2);
253             $(
"#subtotal").val(subtotal);
254             
255             
256     }
257     
258     function callRKeyUp(Ridname)
259     {
260              
var brate = parseInt(Ridname,10);
261              
var quantity = brate-1;
262              
var srate = brate+1;
263              
var avail = srate+1;
264              
var total = avail+1;
265              
266              
267              callQKeyUp(brate-
1)
268              
/*
269              
if(parseInt(Ridname)>0)
270              {
271              quantity=
"00"+quantity;
272              brate=
"000"+brate;
273              srate=
"0000"+srate;
274              avail=
"00000"+avail;
275              total=
"000000"+total
276              
277              }
278              
else
279              {
280               quantity=
"00";
281               brate=
"000";
282               srate=
"0000";
283               avail=
"00000";
284               total=
"000000";
285               
286              }
287             
288             
var result= parseFloat($("#"+quantity).val()) * parseFloat( $("#"+brate).val() );
289             result=result.toFixed(
2);
290             $(
"#"+total).val(result);
291             
292             updateSubtotal();
293     */

294     }
295         
296         
297         $(document).ready(function() {
298             
// SUCCESS AJAX CALL, replace "success: false," by: success : function() { callSuccessFunction() },
299              $(
"#billnumber").focus();
300             
301             
/*$("#"+quantity).keyup(function (e) {
302             
303             $(
"#"+total).val( parseInt( $("#"+qunatity).val()) * parseInt( $("#"+rate).val() ));
304             
if(parseInt($("#"+quantity).val()) > parseInt($("#"+avail).val()))
305             $(
"#"+quantity).val(parseInt($("#"+avail).val()));
306             
307             });
308             
309             $(
"#"+rate).keyup(function (e) {
310             
311             $(
"#"+total).val( parseInt($("#"+quantity).val()) * parseInt($("#"+rate).val()) );
312             
if(parseInt($("#"+quantity).val()) > parseInt($("#"+avail).val()))
313             $(
"#"+quatity).val(parseInt($("#"+avail).val()));
314             
315             });
316                 */

317             
318              $(
"#supplier").blur(function()
319             {
320              
321                             
322              $.post(
'check_supplier_details.php', {stock_name1: $(this).val() },
323                 function(data){
324                 
325                                 $(
"#address").val(data.address);
326                                 $(
"#contact1").val(data.contact1);
327                                 $(
"#contact2").val(data.contact2);
328                                 
if(data.address!=undefined)
329                                 $(
"#0").focus();
330                                 
331                             },
'json');
332                                             
333                     
334
335             
336             });
337             $(
"#form1").validationEngine(),
338             
339             jQuery(document).bind(
'keydown', 'Ctrl+s',function() {
340           $(
'#form1').submit();
341           
return false;
342             });
343             
344             jQuery(document).bind(
'keydown', 'Ctrl+r',function() {
345           $(
'#form1').reset();
346           
return false;
347             });
348             jQuery(document).bind(
'keydown', 'Ctrl+a',function() {
349             window.location =
"add_purchase.php";
350           
return false;
351             });
352             jQuery(document).bind(
'keydown', 'Ctrl+0',function() {
353             window.location =
"admin.php";
354           
return false;
355             });
356             jQuery(document).bind(
'keydown', 'Ctrl+1',function() {
357             window.location =
"add_purchase.php";
358               
return false;
359             });
360             jQuery(document).bind(
'keydown', 'Ctrl+2',function() {
361             window.location =
"add_stock_sales.php";
362               
return false;
363             });
364             jQuery(document).bind(
'keydown', 'Ctrl+3',function() {
365             window.location =
"add_stock_details.php";
366               
return false;
367             });
368             jQuery(document).bind(
'keydown', 'Ctrl+4',function() {
369             window.location =
"add_category.php";
370               
return false;
371             });
372             jQuery(document).bind(
'keydown', 'Ctrl+5',function() {
373             window.location =
"add_supplier_details.php";
374               
return false;
375             });
376             jQuery(document).bind(
'keydown', 'Ctrl+6',function() {
377             window.location =
"add_customer_details.php";
378               
return false;
379             });
380             jQuery(document).bind(
'keydown', 'Ctrl+7',function() {
381             window.location =
"view_stock_entries.php";
382               
return false;
383             });
384             jQuery(document).bind(
'keydown', 'Ctrl+8',function() {
385             window.location =
"view_stock_sales.php";
386               
return false;
387             });
388             jQuery(document).bind(
'keydown', 'Ctrl+9',function() {
389             window.location =
"view_stock_details.php";
390               
return false;
391             });
392             
393             jQuery(document).bind(
'keyup', 'Ctrl+down',function() {
394             $(
'#plus').click();
395               
return false;
396             });
397             
//$.validationEngine.loadValidation("#date")
398             
//alert($("#formID").validationEngine({returnIsValid:true}))
399             
//$.validationEngine.buildPrompt("#date","This is an example","error") // Exterior prompt build example // input prompt close example
400             
//$.validationEngine.closePrompt(".formError",true) // CLOSE ALL OPEN PROMPTS
401         });
402     </script>
403 <style type=
"text/css">
404 <!--
405 body {
406     margin-left: 0px;
407     margin-top: 0px;
408     margin-right: 0px;
409     margin-bottom: 0px;
410     background-color: #FFFFFF;
411 }
412
413 *{
414 padding: 0px;
415 margin: 0px;
416 }
417 #vertmenu {
418 font-family: Verdana, Arial, Helvetica, sans-serif;
419 font-size:
100%;
420 width: 160px;
421 padding: 0px;
422 margin: 0px;
423 }
424
425 #vertmenu h1 {
426 display: block;
427 background-color:#FF9900;
428 font-size:
90%;
429 padding: 3px
0 5px 3px;
430 border: 1px solid #
000000;
431 color: #
333333;
432 margin: 0px;
433 width:159px;
434 }
435
436 #vertmenu ul {
437 list-style: none;
438 margin: 0px;
439 padding: 0px;
440 border: none;
441 }
442 #vertmenu ul li {
443 margin: 0px;
444 padding: 0px;
445 }
446 #vertmenu ul li a {
447 font-size:
80%;
448 display: block;
449 border-bottom: 1px dashed #C39C4E;
450 padding: 5px 0px 2px 4px;
451 text-decoration: none;
452 color: #
666666;
453 width:160px;
454 }
455
456 #vertmenu ul li a:hover, #vertmenu ul li a:focus {
457 color: #
000000;
458 background-color: #eeeeee;
459 }
460 .style1 {color: #
000000}
461 div.pagination {
462
463     padding: 3px;
464
465     margin: 3px;
466
467 }
468
469
470
471 div.pagination a {
472
473     padding: 2px 5px 2px 5px;
474
475     margin: 2px;
476
477     border: 1px solid #AAAADD;
478
479     
480
481     text-decoration: none;
/* no underline */
482
483     color: #
000099;
484
485 }
486
487 div.pagination a:hover, div.pagination a:active {
488
489     border: 1px solid #
000099;
490
491
492
493     color: #
000;
494
495 }
496
497 div.pagination span.current {
498
499     padding: 2px 5px 2px 5px;
500
501     margin: 2px;
502
503         border: 1px solid #
000099;
504
505         
506
507         font-weight: bold;
508
509         background-color: #
000099;
510
511         color: #FFF;
512
513     }
514
515     div.pagination span.disabled {
516
517         padding: 2px 5px 2px 5px;
518
519         margin: 2px;
520
521         border: 1px solid #EEE;
522
523     
524
525         color: #DDD;
526
527     }
528
529     
530 -->
531 </style>
532
533
534 </head>
535
536 <body>
537 <table width=
"100%" border="0" cellspacing="0" cellpadding="0">
538   <tr>
539     <td align=
"center" valign="top"><table width="960" border="0" cellspacing="0" cellpadding="0">
540       <tr>
541         <td><table width=
"960" border="0" cellpadding="0" cellspacing="0" bgcolor="#ECECEC">
542           <tr>
543             <td height=
"90" align="left" valign="top"><img src="images/topbanner.jpg" width="960" height="82"></td>
544           </tr>
545           <tr>
546             <td height=
"500" align="left" valign="top"><table width="960" border="0" cellpadding="0" cellspacing="0" bgcolor="#ECECEC">
547               <tr>
548                 <td width=
"130" align="left" valign="top">
549                 
550                 <br>
551
552                 <strong>Welcome <font color=
"#3399FF"><?php echo $_SESSION['username']; ?> !</font></strong><br> <br>
553 <table width=
"100%" border="0" cellspacing="0" cellpadding="0">
554   <tr>
555     <td align=
"center"><a href="admin.php"><img src="images/home.png" width="130" height="99" border="0"></a></td>
556     </tr>
557   <tr>
558     <td align=
"center">&nbsp;</td>
559     </tr>
560   <tr>
561     <td align=
"center"><a href="add_purchase.php"><img src="images/purchase.png" width="130" height="124" border="0"></a></td>
562     </tr>
563   <tr>
564     <td align=
"center">&nbsp;</td>
565     </tr>
566   <tr>
567     <td align=
"center"><a href="add_stock_sales.php"><img src="images/sales.png" width="146" height="111" border="0"></a></td>
568     </tr>
569   <tr>
570     <td align=
"center">&nbsp;</td>
571     </tr>
572   <tr>
573     <td align=
"center"><a href="report.php"><img src="images/reports.png" width="131" height="142" border="0"></a></td>
574     </tr>
575   <tr>
576     <td align=
"center">&nbsp;</td>
577     </tr>
578   <tr>
579     <td align=
"center">&nbsp;</td>
580     </tr>
581   <tr>
582     <td align=
"center">&nbsp;</td>
583     </tr>
584 </table>
585
586
587     
588                 
589                 
590                 </td> <td height=
"500" align="center" valign="top">
591 <table width=
"100%" border="0" cellspacing="0" cellpadding="0">
592   <tr>
593     <td><a href=
"add_stock_details.php"><img src="images/addstockdetails.png" width="67" height="62" border="0"></a></td>
594     <td><a href=
"add_supplier_details.php"><img src="images/supplier.png" width="67" height="54" border="0"></a></td>
595     <td><a href=
"add_customer_details.php"><img src="images/customer.png" width="67" height="54" border="0"></a></td>
596     <td><a href=
"add_category.php"><img src="images/categories.png" width="67" height="54" border="0"></a></td>
597     <td><a href=
"view_stock_sales.php"><img src="images/vsales.png" width="67" height="54" border="0"></a></td>
598     <td><a href=
"view_stock_entries.php"><img src="images/vpurchase.png" width="67" height="54" border="0"></a></td>
599     <td><a href=
"view_stock_details.php"><img src="images/stockdetails.png" width="67" height="54" border="0"></a></td>
600     <td><a href=
"view_stock_availability.php"><img src="images/savail.png" width="67" height="54" border="0"></a></td>
601      <td align=
"left" valign="top"><a href="view_customer_details.php"><img src="images/customers.png" width="94" height="22" border="0"></a><br> <a href="view_supplier_details.php"><img src="images/suppliers.png" width="94" height="22" border="0"></a><br>
602       <a href=
"view_payments.php"><img src="images/payments.png" width="94" height="22" border="0"></a></td>
603     <td align=
"left" valign="top"><a href="view_stock_sales_payments.php"><img src="images/outstanding.png" width="94" height="22" border="0"></a><br> <a href="view_stock_entries_payments.php"><img src="images/pendings.png" width="94" height="22" border="0"></a><br>
604       <a href=
"logout.php"><img src="images/logout.png" width="94" height="22" border="0"></a></td>
605   </tr>
606 </table>
607                 <?php
608                 
if(isset($_POST['name']))
609
610             {
611             $billnumber=mysql_real_escape_string($_POST[
'billnumber']);
612             $autoid=mysql_real_escape_string($_POST[
'id']);
613             $supplier=mysql_real_escape_string($_POST[
'supplier']);
614             $address=mysql_real_escape_string($_POST[
'address1']);
615             $contact1=mysql_real_escape_string($_POST[
'contact1']);
616             $contact2=mysql_real_escape_string($_POST[
'contact2']);
617             $payment=mysql_real_escape_string($_POST[
'payment']);
618             $balance=mysql_real_escape_string($_POST[
'balance']);
619                 $temp_balance = $db->queryUniqueValue(
"SELECT balance FROM supplier_details WHERE supplier_name='$supplier'");
620                 $temp_balance = (
int) $temp_balance + (int) $balance;
621                 $db->execute(
"UPDATE supplier_details SET balance=$temp_balance WHERE supplier_name='$supplier'");
622             $selected_date=$_POST[
'due'];
623             $selected_date=strtotime( $selected_date );
624             $mysqldate = date(
'Y-m-d H:i:s', $selected_date );
625             $due=$mysqldate;
626             $mode=mysql_real_escape_string($_POST[
'mode']);
627             $description=mysql_real_escape_string($_POST[
'description']);
628             
629             $namet=$_POST[
'name'];
630             $quantityt=$_POST[
'quanitity'];
631             $bratet=$_POST[
'brate'];
632             $sratet=$_POST[
'srate'];
633             $totalt=$_POST[
'total'];
634             $subtotal=mysql_real_escape_string($_POST[
'subtotal']);
635             
636             $username=$_SESSION[
'username'];
637             
638             $i=
0;
639             $j=
1;
640             $username = $_SESSION[
'username'];
641                     $max = $db->maxOfAll(
"id", "stock_details");
642                       $max=$max+
1;
643                       $autoid=
"SD".$max."";
644                $max1 = $db->maxOfAll(
"id", "stock_entries");
645                       $max1=$max1+
1;
646                       $autoid1=
"SE".$max1."";
647         $selected_date=$_POST[
'date'];
648             $selected_date=strtotime( $selected_date );
649             $mysqldate = date(
'Y-m-d H:i:s', $selected_date );
650             
651               
foreach($namet as $name1)
652                {
653                
654             $quantity=$_POST[
'quantity'][$i];
655             $brate=$_POST[
'brate'][$i];
656             $srate=$_POST[
'srate'][$i];
657             $total=$_POST[
'total'][$i];
658             
659             
660             $count = $db->countOf(
"stock_avail", "name='$name1'");
661             
if($count == 0)
662             {
663             $db->query(
"insert into stock_avail(name,quantity) values('$name1',$quantity)");
664             echo
"<br><font color=green size=+1 >New Stock Entry Inserted !</font>" ;
665                
666             $db->query(
"insert into stock_details(stock_id,stock_name,stock_quatity,supplier_id,company_price,selling_price) values('$autoid','$name1',0,'$suplier',$brate,$srate)");
667              
668               
669             $db->query(
"INSERT INTO stock_entries(stock_id,stock_name, stock_supplier_name, quantity, company_price, selling_price, opening_stock, closing_stock, date, username, type, total, payment, balance, mode, description, due, subtotal,count1,billnumber) VALUES ( '$autoid1','$name1','$supplier',$quantity,$brate,$srate,0,$quantity,'$mysqldate','$username','entry',$total,$payment,$balance,'$mode','$description','$due',$subtotal,$j,'$billnumber')");
670             
671             }
672             
673             
else if($count==1)
674             {
675                 $amount = $db->queryUniqueValue(
"SELECT quantity FROM stock_avail WHERE name='$name1'");
676                 $amount1 = $amount + $quantity;
677                 $db->execute(
"UPDATE stock_avail SET quantity=$amount1 WHERE name='$name1'");
678             $db->query(
"INSERT INTO stock_entries(stock_id,stock_name,stock_supplier_name,quantity,company_price,selling_price,opening_stock,closing_stock,date,username,type,total,payment,balance,mode,description,due,subtotal,count1,billnumber) VALUES ('$autoid1','$name1','$supplier',$quantity,$brate,$srate,$amount,$amount1,'$mysqldate','$username','entry',$total,$payment,$balance,'$mode','$description','$due',$subtotal,$j,'$billnumber')");
679             
//INSERT INTO `stock`.`stock_entries` (`id`, `stock_id`, `stock_name`, `stock_supplier_name`, `category`, `quantity`, `company_price`, `selling_price`, `opening_stock`, `closing_stock`, `date`, `username`, `type`, `salesid`, `total`, `payment`, `balance`, `mode`, `description`, `due`, `subtotal`, `count1`)
680             
//VALUES (NULL, '$autoid1', '$name1', '$supplier', '', '$quantity', '$brate', '$srate', '$amount', '$amount1', '$mysqldate', 'sdd', 'entry', 'Sa45', '432.90', '2342.90', '24.34', 'cash', 'sdflj', '2010-03-25 12:32:02', '45645', '1');
681             
682             
683             
684             
685             
686                 
687             
688             }
689             
690             
691                 
692             
693             
694             
695             
696             
697             $i++;
698             $j++;
699             }
700                 echo
"<br><font color=green size=+1 >Parchase order placed successfully Ref: [ $autoid1] !</font>" ;
701                 
702                 
703                 
704                 }
705                 ?>
706                 
707                 <br>
708 <br>
709
710                 
711                 <form name=
"salesform" method="post" id="form1" action="" onSubmit="updateSubtotal()" >
712                   
713                   <p align=
"center"><strong>Add New Purchase Entry </strong> - Add New ( Control +A)</p>
714                  
715                   <table width=
"800" border="0" cellspacing="0" cellpadding="0" id="dynamictable">
716                     <tr>
717                       <td width=
"61">&nbsp;</td>
718                       <td width=
"110">&nbsp;</td>
719                       <td width=
"15">&nbsp;</td>
720                       <td width=
"76">&nbsp;</td>
721                       <td width=
"171">&nbsp;</td>
722                       <td width=
"74">&nbsp;</td>
723                       <td width=
"111">&nbsp;</td>
724                       <td width=
"77">&nbsp;</td>
725                       <td width=
"105">&nbsp;</td>
726                     </tr>
727                     <tr>
728                       <td width=
"61">&nbsp;</td>
729                       <td width=
"110">&nbsp;</td>
730                       <td width=
"15">&nbsp;</td>
731                       <td width=
"76">&nbsp;</td>
732                       <td width=
"171">&nbsp;</td>
733                       <td width=
"74">&nbsp;</td>
734                       <td width=
"111">&nbsp;</td>
735                       <td width=
"77">&nbsp;</td>
736                       <td width=
"105">&nbsp;</td>
737                     </tr>
738                     <tr>
739                       <td width=
"61">&nbsp;</td>
740                       <td width=
"110">&nbsp;</td>
741                       <td>&nbsp;</td>
742                       <td><div align=
"left"><strong>ID</strong>
743                               <?php
744                       $max = $db->maxOfAll(
"id","stock_sales");
745                       $max=$max+
1;
746                       $autoid=
"PR".$max."";
747                       ?>
748                       </div></td>
749                       <td><input name=
"id" type="text" id="id" readonly="" value="<?php echo $autoid; ?>" style="width:50px;"></td>
750                       <td><div align=
"left"><strong>Date</strong></div></td>
751                       <td><input type=
"text" id="datefield" name="date" class="date_input" value="<?php echo date('d-m-Y');?>" style="width:70px;"></td>
752                       <td>&nbsp;</td>
753                       <td>&nbsp;</td>
754                     </tr>
755                     <tr>
756                       <td width=
"61">&nbsp;</td>
757                       <td width=
"110">&nbsp;</td>
758                       <td width=
"15"><div align="left"></div></td>
759                       <td width=
"76">&nbsp;</td>
760                       <td width=
"171"><div align="left"></div></td>
761                       <td width=
"74">&nbsp;</td>
762                       <td width=
"111"><div align="left"></div></td>
763                       <td width=
"77">&nbsp;</td>
764                       <td width=
"105">&nbsp;</td>
765                     </tr>
766                     <tr>
767                       <td><div align=
"center"><strong>Bill No</strong></div></td>
768                       <td><input type=
"text" name="billnumber" style="width:100px;" id="billnumber" class="validate[required,length[0,100]] text-input"></td>
769                       <td>&nbsp;</td>
770                       <td><div align=
"left"><strong>Supplier</strong></div></td>
771                       <td><input name=
"supplier" type="text" id="supplier" value="" style="width:100px;" autocomplete="off" ></td>
772                       <td><div align=
"left">Address</div></td>
773                       <td><textarea name=
"address1" id="address" style="width:100px;"></textarea></td>
774                       <td><div align=
"left">Contact1<br>
775                               <br>
776                         Contact2</div></td>
777                       <td><input name=
"contact1" type="text" id="contact1" value="" style="width:80px;">
778                           <br>
779                           <br>
780                           <input name=
"contact2" type="text" id="contact2" value="" style="width:80px;" ></td>
781                     </tr>
782                     <tr>
783                       <td>&nbsp;</td>
784                       <td>&nbsp;</td>
785                       <td><div align=
"left"></div></td>
786                       <td>&nbsp;</td>
787                       <td><div align=
"left"></div></td>
788                       <td>&nbsp;</td>
789                       <td><div align=
"left"></div></td>
790                       <td>&nbsp;</td>
791                       <td>&nbsp;</td>
792                     </tr>
793                    </table>
794                   <br>
795
796                     <table width=
"800" border="0" cellspacing="0" cellpadding="0" id="duplicate" style="margin-left:20px;">
797                         <tr>
798                       <td ><div align=
"center"><strong>Name</strong></div></td>
799                       <td ><input name=
"name[]" type="text" class="validate[required,length[0,100]] text-input" id="0" style="width:100px;" onFocus="callAutoComplete(this.id)" onBlur="callAutoAsignValue(this.id)" autocomplete="off"></td>
800                       <td><div align=
"left"><strong>Qty</strong></div></td>
801                       <td><input name=
"quantity[]" type="text" id="00" class="validate[required,custom[onlyFloat],lengthCheck[6]] text-input" style="width:50px;" onKeyUp="callQKeyUp(this.id)"></td>
802                       <td><div align=
"left"><strong>Buy Rate:</strong></div></td>
803                       <td><input name=
"brate[]" type="text" id="000" class="validate[required,custom[onlyFloat],lengthCheck[6]] text-input" style="width:50px;" onKeyUp="callRKeyUp(this.id)" ></td>
804                       <td>Sales Rate </td>
805                       <td><input name=
"srate[]" type="text" id="0000" class="validate[optional,custom[onlyFloat],lengthCheck[6]] text-input" style="width:50px;" ></td>
806                       <td>Avail Qty</td>
807                         <td><input name=
"avail[]" type="text" id="00000" readonly="" value="" style="width:50px;" ></td>
808                       <td><div align=
"left"><strong>Total:</strong></div></td>
809                       <td><input name=
"total[]" type="text" id="000000" readonly="" value="" style="width:100px;text-align:right;" > </td>
810                       <td width=
"50"><p><span><a id="minus" href="" >[-]</a> <a id="plus" href="">[+]</a></span></p></td>
811                     </tr>
812                       <tr>
813                         <td>&nbsp;</td>
814                         <td>&nbsp;</td>
815                         <td>&nbsp;</td>
816                         <td>&nbsp;</td>
817                         <td>&nbsp;</td>
818                         <td>&nbsp;</td>
819                         <td>&nbsp;</td>
820                         <td>&nbsp;</td>
821                         <td>&nbsp;</td>
822                         <td>&nbsp;</td>
823                         <td>&nbsp;</td>
824                         <td>&nbsp;</td>
825                         <td>&nbsp;</td>
826                       </tr>
827                       </table>
828                       <table width=
"800" border="0" align="center" cellpadding="0" cellspacing="0" id="duplicate" style="margin-left:20px;">
829                       <tr>
830                         <td>&nbsp;</td>
831                         <td>&nbsp;</td>
832                         <td>&nbsp;</td>
833                         <td>&nbsp;</td>
834                         <td>&nbsp;</td>
835                         <td width=
"103">&nbsp;</td>
836                         <td width=
"140">&nbsp;</td>
837                         <td width=
"5">&nbsp;</td>
838                         <td width=
"5">&nbsp;</td>
839                         <td width=
"5">&nbsp;</td>
840                         <td width=
"13">&nbsp;</td>
841                       </tr>
842                       <tr>
843                         <td>Payment:</td>
844                         <td><input type=
"text" name="payment" style="width:100px; " id="payment" class="validate[required,custom[onlyFloat],lengthCheck[6]] text-input" onKeyUp="balanceCalc()"></td>
845                         <td><div align=
"left">Description</div></td>
846                         <td rowspan=
"2"><textarea name="description" style="width:150px; height:40px; "></textarea></td>
847                         <td>&nbsp;</td>
848                         <td><div align=
"center"><strong>Sub Total </strong></div></td>
849                         <td><input name=
"subtotal" id="subtotal" type="text" readonly="" style="width:100px; text-align:right; color:#333333; font-weight:bold; font-size:16px;"><img src="images/refresh.png" alt="Refresh" align="absmiddle" onClick="updateSubtotal()"></td>
850                         <td>&nbsp;</td>
851                         <td>&nbsp;</td>
852                         <td>&nbsp;</td>
853                         <td>&nbsp;</td>
854                       </tr>
855                       <tr>
856                         <td>Balance:</td>
857                         <td><input name=
"balance" type="text" id="balance" style="width:100px; " value="0.00" readonly=""></td>
858                         <td>&nbsp;</td>
859                         <td>&nbsp;</td>
860                         <td><div align=
"center"></div></td>
861                         <td>&nbsp;</td>
862                         <td>&nbsp;</td>
863                         <td>&nbsp;</td>
864                         <td>&nbsp;</td>
865                         <td>&nbsp;</td>
866                       </tr>
867                       <tr>
868                         <td>&nbsp;</td>
869                         <td>&nbsp;</td>
870                         <td>&nbsp;</td>
871                         <td>&nbsp;</td>
872                         <td>&nbsp;</td>
873                         <td>&nbsp;</td>
874                         <td>&nbsp;</td>
875                         <td>&nbsp;</td>
876                         <td>&nbsp;</td>
877                         <td>&nbsp;</td>
878                         <td>&nbsp;</td>
879                         </tr>
880                       <tr>
881                         <td width=
"55">Mode:</td>
882                         <td width=
"125"><select name="mode">
883                         <option
value="cheque">Cheque</option>
884                         <option
value="cash" selected>Cash</option>
885                         <option
value="others">others</option>
886                         
887                           </
select></td>
888                         <td width=
"77">Due Date </td>
889                         <td width=
"195"><input type="text" id="due" name="due" class="date_input" value="<?php echo date('d-m-Y');?>" style="width:70px;"></td>
890                         <td width=
"77">&nbsp;</td>
891                         <td>&nbsp;</td>
892                         <td>&nbsp;</td>
893                         <td>&nbsp;</td>
894                         <td>&nbsp;</td>
895                         <td>&nbsp;</td>
896                         <td>&nbsp;</td>
897                       </tr>
898                       <tr>
899                         <td>&nbsp;</td>
900                         <td>&nbsp;</td>
901                         <td>&nbsp;</td>
902                         <td>&nbsp;</td>
903                         <td>&nbsp;</td>
904                         <td><div align=
"center">
905                             <input type=
"button" name="Reset" value="Reset">
906                         </div></td>
907                         <td><input type=
"submit" name="Submit" value="Save" onClick="updateSubtotal()" ></td>
908                         <td>&nbsp;</td>
909                         <td>&nbsp;</td>
910                         <td>&nbsp;</td>
911                         <td>&nbsp;</td>
912                         </tr>
913                     </table>
914                 
915                 </form>
916                 <br>
917 <br>
918 <br>
919
920                 
921   
922   </td>
923               </tr>
924             </table> </td>
925           </tr>
926           <tr>
927           
928             <td height=
"30" align="center" bgcolor="#72C9F4">
929             
930 </div><span
class="style1"><a href="http://www.pluskb.com">Developed by PlusKB Innovations</a></span></td>
931           </tr>
932         </table></td>
933       </tr>
934     </table></td>
935   </tr>
936 </table>
937
938
939 </body>
940 </html>
941 <?php
942 }
943 ?>


Gõ tìm kiếm nhanh...